﻿using IteratorDemo;

var listOfValues = new List<int>()
{
    8, 19, 25, 2, 4, 7, 32, 90, 3, 1
};

var listAggregate = new ListAggregate();
foreach (var value in listOfValues)
{
    listAggregate.Insert(value);
}
var listIterator = listAggregate.CreateIterator();
while (listIterator.MoveNext())
{
    Console.Write($"{listIterator.GetCurrent()}, ");
}

var treeAggregate = new SortedBinaryTreeCollection();
foreach (var value in listOfValues)
{
    treeAggregate.Insert(value);
}
var treeIterator = treeAggregate.CreateIterator();
Console.WriteLine("");
Console.WriteLine("Values from Binary Tree Iterator:");
while (treeIterator.MoveNext())
{
    Console.Write($"{treeIterator.GetCurrent()}, ");
}
Console.ReadKey();
